# !/usr/bin/python3
# -*- coding: utf-8 -*-
# ------------------------------------------
# @Time    : Date - 2021/9/4   Time - 11:05
# @Author  : Spence Guo Tang
# @FileName: T2.py
# ------------------------------------------

import sys
import os
import re


class Solution:
    def partitionNumber(self, text):
        length = len(text)
        dp = [[True] * length for _ in range(length)]
        for i in range(length-1, -1, -1):
            for j in range(i+1, length):
                dp[i][j] = (text[i] == text[j]) and dp[i+1][j-1]
        result = []
        stack = []

        def dfs(i):
            if i == length:
                result.append(stack[:])
                return
            for j in range(i, length):
                if dp[i][j]:
                    stack.append(text[i:j+1])
                    dfs(j+1)
                    stack.pop()
        dfs(0)
        return len(result)


if __name__ == '__main__':
    try:
        _text = input()
    except:
        _text = None

    s = Solution()
    res = s.partitionNumber(_text)

    print(str(res) + "\n")
